package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {
    /*@Select("select article_id AS arid," +
            "article_title AS title," +
            "article_content AS cont," +
            "author_id AS auid," +
            "create_time AS time," +
            "article_status AS stat," +
            "article_type AS type " +
            "from article " +
            "where article_title like concat('%',#{str},'%') " +
            "or article_content like concat('%',#{str},'%')")
    public List<Article> search(String str);
    @Select("select article_id AS arid," +
            "article_title AS title," +
            "article_content AS con," +
            "article_picture AS pic," +
            "author_id AS auid," +
            "create_time AS time," +
            "article_type AS type," +
            "article_status AS stat," +
            "article_likes AS likes " +
            "from article " +
            "where article_status = '0'")
    public List<Article> selectByStat();
    @Select("select article_id AS arid," +
            "article_title AS title," +
            "article_content AS con," +
            "article_picture AS pic," +
            "author_id AS auid," +
            "create_time AS time," +
            "article_type AS type," +
            "article_status AS stat," +
            "article_likes AS likes " +
            "from article " +
            "where article_type = #{type}")
    public List<Article> selectByType(int type);
    @Select("select article_id AS arid," +
            "article_title AS title," +
            "article_content AS con," +
            "article_picture AS pic," +
            "author_id AS auid," +
            "create_time AS time," +
            "article_type AS type," +
            "article_status AS stat," +
            "article_likes AS likes " +
            "from article " +
            "where author_id = #{auid}")
    public List<Article> selectByAuid(int auid);*/
}